import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import { fileURLToPath } from "url";
import { dirname, resolve } from "path";
// mock服务现在在API层面实现，不需要vite插件
// import { viteMockServe } from "vite-plugin-mock";

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    // viteMockServe({
    //   mockPath: "src/mock",
    //   localEnabled: true,
    //   prodEnabled: false,
    //   supportTs: true,
    //   watchFiles: true,
    //   logger: true,
    // }),
  ],
  resolve: {
    alias: {
      "@": resolve(__dirname, "src"),
    },
  },
  server: {
    port: 3000,
    proxy: {
      "/admin-api": {
        target: "http://localhost:8080",
        changeOrigin: true,
      },
    },
  },
  base: "/",
});
